﻿Namespace Config

    Public Class Config_B

        Private _config As System.Configuration.Configuration

        Public Sub New()
            _config = System.Configuration.ConfigurationManager.OpenExeConfiguration(Configuration.ConfigurationUserLevel.None)
        End Sub

        Public Sub New(ByVal xmlPath As String)
            _config = System.Configuration.ConfigurationManager.OpenExeConfiguration(xmlPath)
        End Sub

        Public Function GetValue(ByVal key As String) As String

            Try
                Return _config.AppSettings.Settings.Item(key).Value
            Catch ex As Exception
                Return ""
            End Try

        End Function

        Public Function SetValue(ByVal key As String, ByVal value As String) As Boolean

            Try
                _config.AppSettings.Settings.Item(key).Value = value
                _config.Save()

                Return True
            Catch ex As Exception
                Return False
            End Try

        End Function

    End Class
End Namespace

